import scrapy
from env import logger

class CodeforcesSpider(scrapy.Spider):
    name = "codeforces"
    allowed_domains = ["codeforces.com"]
    start_urls = ["https://codeforces.com/"]

    custom_settings = {
        'ITEM_PIPELINES': {'crawl.pipelines.CodeforcesPipeline': 400, },
    }

    def start_requests(self):
        match self.opt:
            case "race":
                url = self.base_url + "acm/contest/vip-index"
                logger.info(f"url:{url}")
                yield scrapy.Request(url, callback=self.race_parse)  # 指定回调函数,否则默认回调parse函数

    def race_parse(self, response):
        pass
